<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of manipulasi
 *
 * @author Obi
 */
class M_member extends DataMapper {

    var $table = 'member';
    var $key = 'id';

    function __construct() {
        parent::__construct();
    }

    //put your code here
    function insert($form) {
        $this->db->insert($this->table, $form);
    }

    function update($form, $id) {
        $this->db->where($this->key, $id);
        $this->db->update($this->table, $form);
    }

    function delete($id) {
        $this->db->where($this->key, $id);
        $this->db->delete($this->table);
    }

    function get_detail($id) {
        $sql = "select
                    member.*,
                    kota.nama_kota,
                    provinsi.nama_provinsi
                from  
                    member, kota, provinsi
                where
                    kota.id_provinsi=provinsi.id  and
                    member.id_kota = kota.id and
                    member.id='$id';";

        $query = $this->db->query($sql);
        return $query->row();
    }

}

?>
